import React, { Component } from 'react'
import Add from './add'
import List from './list'
import Home from './home'
import {Switch, Route, NavLink,Redirect } from 'react-router-dom'
import './app.css'
// imrd
class Myapp extends Component {
  render() {
    return (
      // <Router>
      <div>
        <NavLink to='/'  >首页 </NavLink> &nbsp;&nbsp;
        <NavLink to='/add' activeClassName='red'   >add</NavLink>  &nbsp;&nbsp;
        <NavLink to='/list' activeClassName='red'  >list</NavLink>  &nbsp;&nbsp;
        <Switch>
        {/* exact 精确匹配 */}
          <Route path='/' exact component={Home}></Route>
          <Route path='/add'   component={Add}></Route>
          <Route path='/list'   component={List}></Route>
          {/* <Redirect to='/add' ></Redirect> */}
        </Switch>
      </div>
      // </Router>
    )
  }
}
export default Myapp
